// import 'bootstrap/dist/css/bootstrap.min.css'
import { createApp,Directive } from 'vue'
import {getStatic, registerIcons} from '@/utils/common'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 引入中文包
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from '@/router'
import EsHeader from '@/components/es-header/index.vue'
import EsFooter from '@/components/es-footer/index.vue'
import Pagination from '@/components/es-pagination/index.vue';
import ElementPlus from 'element-plus'
import '@fortawesome/fontawesome-free/css/all.css'
// import '@fortawesome/fontawesome-free/js/all'
import '@/styles/index.scss'
// import '@/styles/prover.min.css'
import ace from 'ace-builds'
import '@/permission'
import EsTable from "@/components/es-table/index.vue"

// import '@/utils/g2plot.min.js'
import {setupSvgIcon} from './plugin/SvgIcon/index'

import {setupComponent} from '@/components/index'

import VueGridLayout from 'vue-grid-layout'

import { GridLayout, GridItem } from 'vue-grid-layout'


// import GridLayout from 'vue3-drr-grid-layout'
// import GridItem from 'vue3-drr-grid-layout'

// import 'vue3-drr-grid-layout/dist/style.css'


// import jQuery from 'jquery'
import jquery from 'jquery'

window.$ = window.jQuery = jquery

// import js_beautify from '@/js/table/beautify.js'

// 导入默认样式
import 'vue-draggable-resizable/dist/VueDraggableResizable.css'

//
import 'bootstrap/dist/js/bootstrap.min.js'

// import * as bootstrap from 'bootstrap/dist/js/bootstrap'
// window.bootstrap = require('bootstrap/dist/js/bootstrap.bundle.js');
import '@/styles/animate.min.css'


import draggable from 'vuedraggable'
// 引入文件
import VueClipBoard from 'vue-clipboard2'
// 挂载到vue 全局


// 自定义指令 v-hasPerm="['sys:user:delete']" v-hasRole="['sysadmin']"
import * as directive from '@/directive';
import i18n from "@/lang";

import { setupStore } from '@/stores'
// symbol 引用
import '@/assets/iconfont/iconfont.js'
import '@/assets/iconfont/iconfont.css'
//设置全局icon样式
import '@/styles/iconGloble.scss'

// 引入动画
import 'animate.css/animate.min.css'
// 引入标尺
import 'vue3-sketch-ruler/lib/style.css'

import { setupNaive, setupDirectives, setupCustomComponents } from '@/plugins'

const test = (async () => {
    const app = createApp(App)
    // await getStatic()
    setupStore(app)
// app.use(jQuery)
    app.use(ElementPlus, {
        // locale: zhCn
        i18n: i18n.global.t,
    })
    app.use(router)
    app.use(VueClipBoard)
    app.use(draggable)
    app.use(VueGridLayout)
    app.use(GridLayout)
    app.use(GridItem)
    app.use(ace as any)
    app.use(i18n)
    app.use(ElementPlus)
    app.component('EsHeader', EsHeader)
    app.component('EsFooter', EsFooter)
    app.component('EsTable', EsTable)
    app.component('Pagination', Pagination)

// 全局挂载和注册 element-plus 的所有 icon
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
        app.component(key, component)
    }
    registerIcons(app) // icons

    // 注册全局常用的 naive-ui 组件
    setupNaive(app)
    // 注册全局自定义指令
    setupDirectives(app)

    // 注册全局自定义组件
    // setupCustomComponents(app)
    setupSvgIcon(app)

    app.mount('#app')
    // 挂载到 window
    window['$vue'] = app


//组件全局化
    setupComponent(app)


// 自定义指令 v-hasPerm="['sys:user:delete']" v-hasRole="['sysadmin']"
    Object.keys(directive).forEach((key) => {
        app.directive(key, (directive as { [key: string]: Directive })[key]);
    });

})
test()

